	<include file='Common:header' />
		<!-- /section:basics/navbar.layout -->
		<div class="main-container" id="main-container">
			<!-- #section:basics/sidebar -->
			<include file='Common:left' />
			<!-- /section:basics/sidebar -->
			<div class="main-content">
				<div class="main-content-inner">
					<div class="page-content">
      <link rel="stylesheet" type="text/css" media="all" href="__PUBLIC__/sldate/daterangepicker-bs3.css" />
      <script type="text/javascript" src="__PUBLIC__/sldate/moment.js"></script>
      <script type="text/javascript" src="__PUBLIC__/sldate/daterangepicker.js"></script>
               <script type="text/javascript">
               $(document).ready(function() {
                  $('#reservation').daterangepicker(null, function(start, end, label) {
                    console.log(start.toISOString(), end.toISOString(), label);
                  });
               });
               </script>
					<form name="admin_list_sea" class="form-search form-horizontal" method="post" action="__URL__/news_list">
							<div class="row maintop">
							<div class="col-xs-12 col-sm-3">
	<select name="keytype">
		<option value="news_title" <if condition="($keytype eq 'news_title') or ($keytype eq '')">selected</if>>按标题</option>
		<option value="news_auto" <if condition="$keytype eq 'news_auto'">selected</if>>按发布人</option>
	</select>
	<select name="diyflag">
		<option value="">按属性</option>
		<foreach name="diyflag" item="v">
		<option value="{$v.diyflag_value}" <if condition="$diyflag_check eq $v['diyflag_value']">selected</if>>{$v.diyflag_name}({$v.diyflag_value})</option>
		</foreach>
	</select>
	<select name="opentype_check">
	  <option value="">状态</option>
	  <option value="1" <if condition="$opentype_check eq '1'">selected="selected"</if>>已审</option>
	  <option value="0" <if condition="$opentype_check eq '0'">selected="selected"</if> >未审</option>
	  </select>
</div>
							
								<div class="col-xs-12 col-sm-3 hidden-xs btn-sespan">
									<div class="input-group">
										<span class="input-group-addon">
											<i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
										</span>
										<input type="text"  name="reservation" id="reservation" class="sl-date" value="{$sldate}" placeholder="点击选择日期范围"/>
									</div>
								</div>
	

							<div class="col-xs-12 col-sm-3 btn-sespan">
								<div class="input-group">
									<span class="input-group-addon">
										<i class="ace-icon fa fa-check"></i>
									</span>
									<input type="text" name="key" id="key" class="form-control search-query admin_sea" value="{$keyy}" placeholder="输入需查询的关键字" />
									<span class="input-group-btn">
										<button type="submit" class="btn btn-xs btm-input btn-purple">
											<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
											搜索
										</button>
									</span>
								</div>
							</div>
								
							  <div class="input-group-btn">
								<a href="__URL__/news_list">
								<button type="button" class="btn btn-xs all-btn btn-purple">
									<span class="ace-icon fa fa-globe icon-on-right bigger-110"></span>
									显示全部
								</button>
								</a>
							  </div>
								
								
							</div>
</form>
					
					
					
							<div class="row">
							    <div class="col-xs-12">
										<div>
                                        <form id="alldel" name="alldel" method="post" action="{:U('news_list_alldel')}" >
										<input name="p" id="p" value="{:I('p',1)}" type="hidden" />
										<div class="table-responsive">
											<table width="100%" class="table table-striped table-bordered table-hover" id="dynamic-table">
												<thead>
													<tr>
														<th width="5%" class="center">
															<label class="pos-rel">
																<input type="checkbox" class="ace"  id='chkAll' onclick='CheckAll(this.form)' value="全选"/>
													  <span class="lbl"></span>															</label>														</th>
													  <th width="5%">ID</th>
													  <th width="40%">文章标题</th>
													  <th width="10%">所属栏目</th>
													  <th width="12%">文章属性</th>
													  <th width="6%">点击</th>
													  <th width="6%">状态</th>
													  <th width="9%">发布时间</th>
													  <th width="7%" style="border-right:#CCC solid 1px;">操作</th>
												  </tr>
												</thead>

												<tbody>
                                                
                                                <foreach name="news" item="v">
													<tr>
														<td align="center">
														<label class="pos-rel">
															<input name='n_id[]' id="navid" class="ace"  type='checkbox' value='{$v.n_id}'>
														<span class="lbl"></span>
														</label>
														</td>
														<td align="center">{$v.n_id}</td>
														<td><a href="" target="_blank" title="{$v.news_title}">{$v.news_title|subtext=25}</a>【{$v.news_auto}】</td>
														<td>{$v.column_name}</td>
														<td>
													<if condition="strstr($v['news_flag'],'h') eq true"><span style="color:#03C">头</span></if>
                                                    <if condition="strstr($v['news_flag'],'c') eq true"><span style="color:#060">荐</span></if>
                                                    <if condition="strstr($v['news_flag'],'f') eq true"><span style="color:#09F">幻</span></if>
                                                    <if condition="strstr($v['news_flag'],'a') eq true"><span style="color:#63C">特</span></if>
                                                    <if condition="strstr($v['news_flag'],'s') eq true"><span style="color:#C0C">滚</span></if>
                                                    <if condition="strstr($v['news_flag'],'p') eq true"><span style="color:#960">图</span></if>
                                                    <if condition="strstr($v['news_flag'],'j') eq true"><span style="color:#C00">跳</span></if>
                                                    <if condition="strstr($v['news_flag'],'d') eq true"><span style="color:#630">原</span></if>
														</td>
														<td>{$v.news_hits}</td>
														<td>
														<if condition='$v[news_open] eq 1'>
														<a class="red" href="javascript:;" onclick="return stateyes({$v.n_id});" title="已开启">
														<div id="zt{$v.n_id}"><button class="btn btn-minier btn-yellow">开启</button></div>
														</a>
														<else/>
														<a class="red" href="javascript:;" onclick="return stateyes({$v.n_id});" title="已禁用">
														<div id="zt{$v.n_id}"><button class="btn btn-minier btn-danger">禁用</button></div>
														</a>
														</if>
														</td>
														<td>{$v.news_time|date='Y-m-d',###}</td>
														<td>
		<div class="hidden-sm hidden-xs action-buttons">
			<a class="green" href="{:U('news_list_edit',array('n_id'=>$v['n_id']))}" title="修改">
				<i class="ace-icon fa fa-pencil bigger-130"></i>
			</a>
			<a class="red" href="javascript:;" onclick="return del({$v.n_id},{:I('p',1)});" title="回收站">
				<i class="ace-icon fa fa-trash-o bigger-130"></i>
			</a>
		</div>
														</td>
													</tr>
                                                 </foreach>   
                                                  <tr>
													  <td align="left"><button id="btnsubmit" class="btn btn-white btn-yellow btn-sm">删</button> </td>
													  <td colspan="8" align="right">{$page}</td>
												  </tr>
												</tbody>
											</table>
											</div>
                                          </form>
							    		</div>
									</div>
								</div>

<include file='Common:header_nav' />

					</div><!-- /.page-content -->
				</div>
			</div><!-- /.main-content -->

<script>
function del(id,p){
		layer.confirm('你确定要转移到回收站吗？', {icon: 3}, function(index){
	    layer.close(index);
	    window.location.href="__URL__/news_list_del/n_id/"+id+"/p/"+p+"";//重新获取当前页面，删除后返回当前页码
	});
}


function unselectall(){
if(document.myform.chkAll.checked){
document.myform.chkAll.checked = document.myform.chkAll.checked&0;
}
}
function CheckAll(form){
for (var i=0;i<form.elements.length;i++){
var e = form.elements[i];
if (e.Name != 'chkAll'&&e.disabled==false)
e.checked = form.chkAll.checked;
}
}

</script>
<script>
$(function(){
	$('#alldel').ajaxForm({
		beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置，一般是判断为空获取其他规则
		success: complete, // 这是提交后的方法
		dataType: 'json'
	});
	
	function checkForm(){
				var chk_value =[];    
				$('input[id="navid"]:checked').each(function(){    
					chk_value.push($(this).val());    
				});
				
				if(!chk_value.length){
					layer.alert('至少选择一个删除项', {icon: 6}); 
					return false;
				}
	}
	 
	function complete(data){
		if(data.status==1){
			layer.alert(data.info, {icon: 6}, function(index){
 			layer.close(index);
			window.location.href=data.url;
			});
		}else{
			layer.alert(data.info, {icon: 6}, function(index){
 			layer.close(index);
			window.location.href=data.url;
			});
		}
	}
 
});


function stateyes(val){
		  $.post('{:U("news_list_state")}',
		  {x:val},
	function(data){
	var $v=val;
		if(data.status){
			if(data.info=='状态禁止'){
				var a='<button class="btn btn-minier btn-danger">禁用</button>'
				$('#zt'+val).html(a);
				return false;
			}else{
				var b='<button class="btn btn-minier btn-yellow">开启</button>'
				$('#zt'+val).html(b);
				return false;
			}
			
		}
	});
	return false;
}
</script>
	<include file='Common:footer' />
    
		</div><!-- /.main-container -->
	</body>
</html>
